import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sports_new/view/my/widgets/my_appbar.dart';
import 'package:sports_new/view/my/widgets/my_cellbox.dart';

import '../../resources/colours.dart';
import '../../widgets/base/qkd_text.dart';
import '../../utils/sp_utils.dart';

class PersonalAdsPage extends StatefulWidget {
  const PersonalAdsPage({super.key});

  @override
  State<PersonalAdsPage> createState() => _PersonalAdsPageState();
}

class _PersonalAdsPageState extends State<PersonalAdsPage> {
  bool _open = true;

  bool get open => _open;

  set open(bool value) => setState(() => _open = value);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colours.scaffoldBg,
      appBar: const MyAppBar(title: "个性化广告"),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(height: 10),
          MyCellBox(
            children: [
              Container(
                padding: const EdgeInsets.symmetric(horizontal: 12),
                height: 52,
                child: Row(
                  children: [
                    QkdText("个性化广告", fontSize: 16),
                    const Spacer(),
                    CupertinoSwitch(
                      activeColor: Colours.main,
                      value: SpUtils.personalAds,
                      onChanged: (value) {
                        SpUtils.personalAds = value;
                        setState(() {});
                      }
                    )
                  ],
                ),
              )
            ]
          ).paddingSymmetric(horizontal: 8),
          Container(height: 4),
          QkdText(
            "关闭后，广告数量不变但相关性会降低",
            fontSize: 13,color: Colours.grey66
          ).paddingSymmetric(horizontal: 16)
        ],
      )
    );
  }
}
